home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SunSoft Catalyst CDWARE 1996 May to August
/
Catalyst CDWARE 1996 May to August.iso
/
.products
/
USoft
/
cgi-bin
/
support-.pl
< prev
next >
Wrap
Perl Script
|
1996-02-15
|
4KB
|
148 lines
#!/bin/perl
$datum=`date`;
$sendto='support@usoft.nl';
sub ReadParse {
local (*in) = @_ if @_;
local ($i, $key, $val);
# Read in text
if (&MethGet) {
$in = $ENV{'QUERY_STRING'};
} elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
}
@in = split(/&/,$in);
foreach $i (0 .. $#in) {
# Convert plus's to spaces
$in[$i] =~ s/\+/ /g;
# Split into key and value.
($key, $val) = split(/=/,$in[$i],2); # splits on the first =.
# Convert %XX from hex numbers to alphanumeric
$key =~ s/%(..)/pack("c",hex($1))/ge;
$val =~ s/%(..)/pack("c",hex($1))/ge;
# Associate key and value
$in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple separator
$in{$key} .= $val;
}
return length($in);
}
# PrintHeader
# Returns the magic line which tells WWW that we're an HTML document
sub PrintHeader {
return "Content-type: text/html\n\n";
}
# MethGet
# Return true if this cgi call was using the GET request, false otherwise
sub MethGet {
return ($ENV{'REQUEST_METHOD'} eq "GET");
}
# MyURL
# Returns a URL to the script
sub MyURL {
return 'http://' . $ENV{'SERVER_NAME'} . $ENV{'SCRIPT_NAME'};
}
# CgiError
# Prints out an error message which which containes appropriate headers,
# markup, etcetera.
# Parameters:
# If no parameters, gives a generic error message
# Otherwise, the first parameter will be the title and the rest will
# be given as different paragraphs of the body
sub CgiError {
local (@msg) = @_;
local ($i,$name);
if (!@msg) {
$name = &MyURL;
@msg = ("Error: script $name encountered fatal error");
};
print &PrintHeader;
print "<html><head><title>$msg[0]</title></head>\n";
print "<body><h1>$msg[0]</h1>\n";
foreach $i (1 .. $#msg) {
print "<p>$msg[$i]</p>\n";
}
print "</body></html>\n";
}
if (&ReadParse(*input)) {
print &PrintHeader;
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Thank you for using this Support-Request form</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<H1>Thank you for using this Support-Request form<H3>";
print "The Support-Desk will try to accomodate your request as soon as possible<P>\n";
print "Request submitted on: $datum<p>";
print "</BODY>\n";
print "</HTML>\n";
}
else {
print "Something has gone wrong; No request send to USoft Support ($sendto)";
};
$reportedby=$input{"reportedby"};
$company=$input{"company"};
$reference=$input{"reference"};
$regno=$input{"regno"};
$phone1=$input{"phone1"};
$phone2=$input{"phone2"};
$fax=$input{"fax"};
$email=$input{"email"};
$city=$input{"city"};
$country=$input{"country"};
$product=$input{"product"};
$pversion=$input{"pversion"};
$ostype=$input{"ostype"};
$osversion=$input{"osversion"};
$computer=$input{"computer"};
$model=$input{"model"};
$dbase=$input{"dbase"};
$dbversion=$input{"dbversion"};
$description=$input{"description"};
$middleware=$input{"middleware"};
open (MAIL, "|/cgi-bin/smtpsend");
print MAIL "To: $sendto\n";
print MAIL "From: WWW\@www.usoft.com\n";
print MAIL "Subject: Support Request Form\n\n";
print MAIL "Location: http://www.usoft.com\n\n";
print MAIL "Submitted on: $datum\n";
print MAIL "Reported by : $reportedby\n";
print MAIL "Registration Number: $regno\n";
print MAIL "Company : $company\n";
print MAIL "City : $city\n";
print MAIL "Country : $country\n";
print MAIL "Phone1 : $phone1\n";
print MAIL "Phone2 : $phone2\n";
print MAIL "Fax : $fax\n";
print MAIL "EMail : $email\n";
print MAIL "-------------------------------------------------------------------------------\n";
print MAIL "Product : $product\n";
print MAIL "Version : $pversion\n";
print MAIL "\n";
print MAIL "O.S. : $ostype\n";
print MAIL "Version : $osversion\n";
print MAIL "\n";
print MAIL "Computer : $computer\n";
print MAIL "Model : $model\n";
print MAIL "\n";
print MAIL "Middleware : $middleware\n";
print MAIL "\n";
print MAIL "DBase : $dbase\n";
print MAIL "Version : $dbversion\n";
print MAIL "\n";
print MAIL "Description:\n";
print MAIL "$description";
print MAIL "\n--end of Support Request form--\n";
close (MAIL);
print "Support Request Mail Submitted...";